package fileserver

import (
	"github.com/gogf/gf/net/ghttp"
	"snake/app/service/script"
	"snake/library/base"
)

type Action struct {
	base.BaseRouter
}

// path: /download/script/{id}
func (action *Action) DownloadScript(r *ghttp.Request) {
	id := r.GetInt64("id")
	text, err := script.GetContextById(id)
	if err != nil {
		base.Fail(r, err.Error())
	}
	base.RespTextSucc(r, text)
}